import store from "store2";

export const AUTHORIZATION_CODE_LIST = ["A0230", "A0311"];

export const REQ_FAIL_ERROR_MSG = {
  abort: "request:fail abort",
  timeout: "request:fail timeout",
};

export const reqHead = () => {
  let tokenId = store.get("token");
  let adapterToken = store.get("adapterToken");
  let localeLang = "zh-CN";

  const header = {
    // 'Content-Type': 'multipart/form-data',
    "Accept-Language": localeLang,
    "x-app": "gpt", // 自建应用
  };
  if (tokenId) {
    header["Authorization"] = `Bearer ${tokenId}`;
  }
  if (adapterToken) {
    header["Authorization"] = `Trust ${adapterToken}`;
  }

  return header;
};
